/**
 ******************************************************************************
 * @file           : test_container.c
 * @author         : wyj
 * @brief          : None
 * @attention      : None
 * @date           : 2025/5/9
 ******************************************************************************
 */


#ifdef __cplusplus
extern "C"
{
#endif

#include "geometry/studio_geo_c.h"

#ifdef __cplusplus
}
#endif


#include <stdio.h>


int main()
{
    printf("===================== %s =====================\n", __FILE__);

    // 初始化线段
    studio_line_c line = studio_line_c_init();

    // 添加点
    for (int i = 0; i < 50; ++i)
    {
        studio_point_c p = studio_point_init(i * 1.0, i * 2.0);
        studio_line_c_add_point(&line, p);
    }

    // 遍历点
    for (size_t i = 0; i < line.size; ++i)
    {
        studio_point_c p = studio_line_c_get_point(&line, i);
        printf("Point %zu: (%.1f, %.1f)\n", i, p.x, p.y);
    }
    // 修改点
    // for (size_t i = 0; i < line.size; ++i)
    // {
    //     studio_point_c  p = studio_point_init(111, 111);
    //     studio_line_c_set_point(&line, i, p);
    // }
    // 删除
    for (size_t i = 10; i < line.size; )
    {
        // 删除中间点（索引1）
        if (!studio_line_c_remove_point(&line, i)) {
            printf("删除失败\n");
        }
    }
    for (size_t i = 0; i < line.size; ++i)
    {
        studio_point_c p = studio_line_c_get_point(&line, i);
        printf("Point %zu: (%.1f, %.1f)\n", i, p.x, p.y);
    }

    // 释放内存
    studio_line_c_destroy(&line);
    return 0;



    return 0;
}
